<script type="application/javascript">
	function changeCurr(id,price)
	{
		
		usd = document.getElementById(id+"usd");
		sjc = document.getElementById(id+"sjc");
		vnd = document.getElementById(id+"vnd");
		
		usdid = document.getElementById("usd"+id);
		sjcid = document.getElementById("sjc"+id);
		vndid = document.getElementById("vnd"+id);
		
		if(price == "usd")
		{
			usd.style.display = "block";
			sjc.style.display = "none";
			vnd.style.display = "none";
			
			usdid.className = "USD active_rate";
			sjcid.className = "USD";
			vndid.className = "USD";
		}
		else if(price == "sjc")
		{
			usd.style.display = "none";
			sjc.style.display = "block";
			vnd.style.display = "none";
			usdid.className = "USD";
			sjcid.className = "USD active_rate";
			vndid.className = "USD";
		}
		else if (price == "vnd")
		{
			usd.style.display = "none";
			sjc.style.display = "none";
			vnd.style.display = "block";
			usdid.className = "USD";
			sjcid.className = "USD";
			vndid.className = "USD active_rate";
		}
	}
</script>
<?php 
$data =$result;
if(!empty($data))
{ 

?>
	<div class="left_title_cuv"></div>
    <?php if(empty($result1)){?>
    <div class="mid_title_cuv"><?php // if(empty($_SESSION['lang'])) echo $result2['cat_name_en'];else echo $result2['cat_name']?></div>
    <?php }else {?>
<div class="mid_title_cuv"><?php if(empty($_SESSION['lang'])) echo $result2['cat_name_en'].": ".$result1['type_name_en'];else echo $result2['cat_name'].": ".$result1['type_name']?></div>
	<?php }?>
        <div class="content">
        	<?php foreach($data as $subitem){?>
        	<div class="outer_pro" style="margin-left:0px;">
            		<a href="<?php echo base_url()?>index.php/news/detail/<?php echo $subitem['news_id']?>/<?php echo $subitem['cat_id']?>">
                   	 <img src="<?php echo base_url()?>upload/news/<?php echo $subitem['news_image']?>" class="img_pro"/>
                    </a>
            		<a href="javascript:changeCurr(<?php echo $subitem['news_id']?>,'usd');" id="usd<?php echo $subitem['news_id']?>" class="USD active_rate" style="margin-left:30px;">USD</a>
                	<a href="javascript:changeCurr(<?php echo $subitem['news_id']?>,'sjc');" id="sjc<?php echo $subitem['news_id']?>" class="USD">SJC</a>
                    <a href="javascript:changeCurr(<?php echo $subitem['news_id']?>,'vnd');" id="vnd<?php echo $subitem['news_id']?>" class="USD">VND</a>
                   
                    <span id="<?php echo $subitem['news_id']?>usd"><?php echo $subitem['news_price_usd'] ?> usd</span>
                    <span id="<?php echo $subitem['news_id']?>sjc"style="display:none" ><?php echo $subitem['news_price_sjc'] ?> sjc</span>
                    <span id="<?php echo $subitem['news_id']?>vnd"style="display:none" ><?php echo number_format($subitem['news_price_vnd'])?> vnd</span>
                    <a href="<?php echo base_url()?>index.php/news/detail/<?php echo $subitem['news_id']?>/<?php echo $subitem['cat_id']?>" class="pro_info"><?php if(empty($_SESSION['lang'])) echo $subitem['news_short_en'];else echo $subitem['news_short']?></a>
                    
            </div><!--end outer_pro-->
            <?php } ?>
            
            <div class="page"><?php echo $page?></div>
            
            
        </div><!--end content-->
<?php } else if(empty($_SESSION['lang'])) echo "The data is update";else echo "Dữ liệu hiện đang cập nhật"?>